package org.ihelpuoo.weboo.upload.index;

import java.io.File;
import java.io.IOException;
import java.math.MathContext;

import org.ihelpuoo.io.FileUtils;

public abstract class AbstractIndexMaker implements IndexMaker
{
	protected MathContext	precision	= new MathContext(4);

	public void make(File org, File indexed, int w, int h) throws UnacceptableFileException,
			FailToSaveIndexException
	{
		if (org == null)
			throw new UnacceptableFileException("Input file is NULL!");
		if (!org.exists())
			throw new UnacceptableFileException("Input file didn't existed! "
					+ org.getAbsolutePath());
		if (indexed == null)
			throw new FailToSaveIndexException("Output file is NULL!");

		if (!indexed.exists())
			try
			{
				FileUtils.createNewFile(indexed);
			}
			catch (IOException e)
			{
				throw new UnacceptableFileException(indexed,e);
			}

	}
}
